#pragma once
#include "MouseAnimator.h"
#include "TableParser.h"
#include "AiBrain.h"
#include "BotCore.h"


struct RectF
{//0..1 coords
	double T;
	double B;
	double L;
	double R;
};


//---------------------------------------------------------------------------------------
struct GuiRects
{
	RectF CallBtn;
	RectF FoldBtn;
	RectF RaiseBtn;
	RectF RaiseEdit;
};


//---------------------------------------------------------------------------------------
class AiPlayer
{
	friend class AiBrain;

	GuiRects		Rects;
	HWND			PokerWindow;
	MouseAnimator	MouseAnim;
	AiBrain::Actions Action;
	int				RaiseCnt;
	AiBrain			Brain;


public:
	CPlayer		   *PlayerInfo;
	Table		   *TableInfo;
	CPlayer		   *PlayerCache;
	Table		   *TableCache;
	int				MyPos;
	
	

private:
	inline RECT RectFtoRect(RectF &iR) const;
	inline HWND ClickOnRect(RectF &iR) const;
	bool  ValidateData() const;
	
public:
	AiPlayer();
	
	void GetMessage(TCHAR *oBuf);
	void SetWindow(HWND iPokerWindow) { PokerWindow = iPokerWindow; }
	void SetGameInfo(CPlayer *iPlayers, Table *iTableInfo, int iMyPos) { PlayerInfo = iPlayers; TableInfo = iTableInfo; MyPos = iMyPos; }
	void SetCacheInfo(CPlayer *iPlayersCache, Table *iTableCache) { PlayerCache = iPlayersCache; TableCache = iTableCache; }
	void Raise(int iCount);
	void Call();
	void Check();
	void Fold();
	void AllIn();
	void Think();
	void Play(CBotCore::Actions Action, int Stake);

	~AiPlayer();
};
